﻿namespace LogManager.Core.Services
{
    using System;

    public class SimpleServiceResult
    {
        public bool Succeeded { get; private set; }
        public string Message { get; private set; }
        public Exception Error { get; protected set; }

        protected SimpleServiceResult(bool succeeded, string message)
        {
            this.Succeeded = succeeded;
            this.Message = message;
        }

        public static SimpleServiceResult CreateSuccess(string message)
        {
            return new SimpleServiceResult(true, message);
        }

        public static SimpleServiceResult CreateFailure(string message, Exception error)
        {
            var instance = new SimpleServiceResult(false, message);
            instance.Error = error;
            return instance;
        }
    }
}